// window.VUE_APP_NODE_ENV = 'test';
window.VUE_APP_NODE_ENV = 'production';
const service = axios.create({
  baseURL: VUE_APP_NODE_ENV === 'production' ? 'https://zybs.91boshuo.com/zpglapi' : 'https://cs.91boshuo.com/zpgl',
  timeout: 50000,
});
const servicePersonnel = axios.create({
  baseURL: VUE_APP_NODE_ENV === 'production' ? 'https://zybs.91boshuo.com/rsxtapi' : 'https://cs.91boshuo.com/rsxt',
  timeout: 50000,
});
const serviceCustomer = axios.create({
  baseURL: VUE_APP_NODE_ENV === 'production' ? 'https://zybs.91boshuo.com/khglapi' : 'https://cs.91boshuo.com/khgl',
  timeout: 50000,
});
service.interceptors.request.use(
  (config) => {
    if (localStorage.getItem('ssoToken')) {
      config.headers["Authorization"] = localStorage.getItem('ssoToken');
      config.headers["AccessControlAllowOrigin"] = '*';
    }
    return config;
  },
  (error) => {
    console.log(error); // for debug
    return Promise.reject(error);
  }
);
service.interceptors.response.use(
  (response) => {
    const res = response.data;
    if (res.code == 200) {
      return Promise.resolve(res);
    } else {
      return Promise.reject(res);
    }
  },
  (error) => {
    return Promise.reject(error);
  }
);
servicePersonnel.interceptors.request.use(
  (config) => {
    if (localStorage.getItem('ssoToken')) {
      config.headers["Authorization"] = localStorage.getItem('ssoToken');
      config.headers["AccessControlAllowOrigin"] = '*';
    }
    return config;
  },
  (error) => {
    console.log(error); // for debug
    return Promise.reject(error);
  }
);
servicePersonnel.interceptors.response.use(
  (response) => {
    const res = response.data;
    if (res.code == 200) {
      return Promise.resolve(res);
    } else {
      return Promise.reject(res);
    }
  },
  (error) => {
    return Promise.reject(error);
  }
);
serviceCustomer.interceptors.request.use(
  (config) => {
    if (localStorage.getItem('ssoToken')) {
      config.headers["Authorization"] = localStorage.getItem('ssoToken');
      config.headers["AccessControlAllowOrigin"] = '*';
    }
    return config;
  },
  (error) => {
    console.log(error); // for debug
    return Promise.reject(error);
  }
);
serviceCustomer.interceptors.response.use(
  (response) => {
    const res = response.data;
    if (res.code == 200) {
      return Promise.resolve(res);
    } else {
      return Promise.reject(res);
    }
  },
  (error) => {
    return Promise.reject(error);
  }
);
//获取码表
function mbList(query) {
  return servicePersonnel({
    url: "/sys/webCode/allDataList",
    method: "get",
    params: query,
  });
}
//省市区码表
function listTreeDistrict(query) {
  return servicePersonnel({
    url: "/sys/webCode/listTreeDistrict",
    method: "get",
    params: query,
  });
}

// 会议线路表(不分页列表)
function meetingLineLists(query) {
  return service({
    url: "/bs/meetingLine/lists",
    method: "get",
    params: query,
  });
}
// 会议类型表(分页列表)
function meetingTypeListPage(query) {
  return service({
    url: "/bs/meetingType/lists",
    method: "get",
    params: query,
  });
}
// 排期详情
function meetingScheduleInfo(query) {
  return service({
    url: "/bs/meetingSchedule/info",
    method: "get",
    params: query,
  });
}
// 客户产品信息
function productList(query) {
  return serviceCustomer({
    url: "/bs/product/lists",
    method: "get",
    params: query,
  });
}
